home *** CD-ROM | disk | FTP | other *** search
- /* Programm: PlayHifi.dopus5
- ** $VER: PlayHifi.dopus5 1.2 (10-Okt-95)
- **
- ** Needed: Directory Opus V5.xx (© by Jonathan Potter & GPSoftware)
- ** Play16 (© 1995 by Thomas Wenzel)
- ** mpega (© 1995 by Stephane Tavenard) or/and PeggyPlus MPEG-Card
- ** PlayADPCM (Autor Christian Buchner)
- **
- ** Copyright © 1995 Eckhard Ludwig (Eckhard@top.east.de)
- ** PlayHifi.dopus5 is copyrighted freeware. It may be distributed freely.
- **
- ** Call as:
- ** ------------------------------------------------------------------------------
- ** ARexx DOpus5:ARexx/PlayHifi.dopus5 {Qp}
- ** ------------------------------------------------------------------------------
- ** Set all Attribut off.
- */
-
- /*--------S E T T I N G S : -------------------------------------------*/
- /* If the file ENV:PlayHifi.PREFS exists, that one will override the */
- /* settings here ... */
-
- /*- Path to Player command --------------------------------------------*/
- Play16 = "C:Play16"
- PL16_OPTIONS=" Paula14 FILTER=OFF"
-
- PlayADPCM = "C:PlayADPCM"
-
- /*- Path to MPEGPlayer command ----------------------------------------*/
- PlayMPEG = "C:mpega" /* Softwareplayer */
- MPEGA_OPTIONS=" -p -f0 -d2 -q2 " /* edit options for your system ! */
- /*---------------------------------------------------------------------*/
-
- Index = 'T:PlayDOpus5Index.temp' /* Temporaere Titelliste */
- parse arg portname
- if portname='' then
- portname='DOPUS.1'
- address value portname
-
- options results
- options failat 21
- lf='0a'x
-
- address command 'Delete >NIL: '||Index /*falls Index in Benutzung, läuft Player bereits*/
-
- if open(1,'env:PlayHifi.prefs','R') then do
- do i=1 to 6
- prefs.i = readln(1)
- end
- if prefs.2 ~="" then PLAY16=prefs.2
- if prefs.3 ~="" then PlayADPCM=prefs.3
- if prefs.4 ~="" then PlayMPEG=prefs.4
- if prefs.5 ~="" then PL16_OPTIONS=prefs.5
- if prefs.6 ~="" then MPEGA_OPTIONS=prefs.6
- drop prefs.
- end
- call close(1)
-
- if ~show('l','rexxsupport.library') then
- call addlib('rexxsupport.library',0,-30,0)
-
- /* init locale */
- if ~show(l,'locale.library') then
- call addlib('locale.library',0,-30)
- if show(l,'locale.library') then
- catalog=opencatalog('PlayHifi.catalog','english',0)
-
- lister query source
- if rc>0 then do
- dopus front
- dopus request '"'getcatstr(0,'Error:'lf'No source selected')'"' getcatstr(1,'Quit')
- exit
- end
-
- parse var result handle
-
- lister query handle numselfiles
- if result=0 then do
- dopus front
- dopus request '"'getcatstr(2,'Error:'lf'No entry selected')'"' getcatstr(1,'Quit')
- exit
- end
-
- if exists(Index) then Index=Index||'1'
- else Test2=1
-
- if exists(Index) then call open('output',Index,'A')
- else do
- if open('output',Index,'w') ~=1 then do
- dopus request '"'getcatstr(3,'Error:'lf'Load script in to editor and set path to Index !')'"' getcatstr(1,'Quit')
- exit
- end
- end
-
- lister set handle busy on
- lister query handle path
- QuellPfad=result
-
- lister query handle selfiles stem files.
- lister set handle progress files.count getcatstr(4,'Scanning for Index...')
- lister refresh handle full
-
- do i=0 to files.count-1
- lister query handle abort
- if result then do
- test=0
- leave
- end
- lister set handle progress count i+1
- lister set handle progress name files.i
- Titel=Quellpfad||files.i
- call DTTEST
- if DT~=0 then do
- lister query handle entry '"'files.i'"' stem fileinfo.
- call writeln('output',Titel' @SIZE='fileinfo.size' @COMMENT='fileinfo.comment)
- test=1
- end
- lister select handle '"'files.i'"' off
- end
- lister refresh handle full
- lister set handle busy off
- call close('output')
-
- if Test2~=1 then do
- if test=1 then do
- dopus front
- dopus request '"'getcatstr(14,'Songs added to playlist')'"' 'OK'
- end
- exit
- end
- if test ~=1 then do
- address command 'Delete >NIL: '||Index
- exit
- end
-
- lister new
- handle=result
- lister set handle title getcatstr(5,'Hifi Player')
- do forever
- lister set handle sort date
- call open('input2',Index,'R')
- do i = 1 to 200
- Zeile=readln('input2')
- if Zeile="" then leave
- SPOS=pos("@SIZE=",Zeile)
- CPOS=pos("@COMMENT=",Zeile)
- Titel=left(Zeile,SPOS-2)
- if ~exists(Titel) then do
- dopus front
- dopus request '"'getcatstr(8,'Error:'lf"'%s'"' not found !',Titel)'"' getcatstr(7,'Next')
- iterate
- end
- call DTTEST
- select
- when DT="MP2" then MPEG=1
- when DT="ADPCM3" then ADPCM=1
- otherwise Play16DT=1
- end
- APOS=lastpos("/",Titel)
- if APOS=0 then APOS=lastpos(":",Titel)
- songname=substr(Titel,APOS+1)
- lister add handle '"'songname'" 'substr(Zeile,SPOS+6,CPOS-SPOS-6)' -1 'i' r 'substr(Zeile,CPOS+9)''
- lister select handle '"'songname'"' on
- lister set handle display name size comment
- end
- lister refresh handle full
- call close ('input2')
-
- if MPEG=1 & ~show('P','Peggy') then do
- if showlist("A","PEGGYPLUS")=1 then do
- test=2
- address command 'stack 8192'
- address command 'RUN >NIL: <NIL: PEGGYPLUS:MPEGPlayer'
- address command 'waitforport Peggy'
- address value portname
- dopus front
- end
- else do
- if ~exists(PlayMPEG) then do
- dopus front
- dopus request '"'getcatstr(9,'Error:'lf'MPEG-Player not found !'lf'path to command: '"'%s'"'',PlayMPEG)'"' getcatstr(1,'Quit')
- call Ende
- end
- end
- end
- if ADPCM=1 & ~exists(PlayADPCM) then do
- dopus front
- dopus request '"'getcatstr(10,'Error:'lf'ADPCM-Player not found !'lf'path to command: '"'%s'"'',PlayADPCM)'"' getcatstr(1,'Quit')
- call Ende
- end
- if Play16DT=1 & ~exists(Play16) then do
- dopus front
- dopus request '"'getcatstr(11,'Error:'lf'Play16 not found !'lf'path to command: '"'%s'"'',Play16)'"' getcatstr(1,'Quit')
- call Ende
- end
-
- if open('input2',Index,'R') ~=1 then exit
- lister set handle busy on
- lister query handle selfiles stem files.
- lister set handle progress files.count getcatstr(12,'Play sound ...')
- lister refresh handle
-
- do i=0 to files.count-1
- lister query handle abort
- if result then leave
- lister set handle progress count i+1
- lister set handle progress name i+1"/"files.count" "files.i
- Zeile=readln('input2')
- if Zeile="" then leave
- Titel=left(Zeile,pos("@SIZE",Zeile)-2)
- APOS=lastpos("/",Titel)
- if APOS=0 then APOS=lastpos(":",Titel)
- songname=substr(Titel,APOS+1)
- if songname ~=files.i then do
- i=i-1
- iterate
- end
- if ~exists(Titel) then do
- dopus front
- dopus request '"'getcatstr(8,'Error:'lf"'%s'"' not found !',Titel)'"' getcatstr(7,'Next')
- iterate
- end
- call DTTEST
- select
- when DT="MP2" then do
- if show('P','Peggy') then do
- address 'Peggy'
- if MPEG=1 then do
- open Titel
- setwindow XOFF 0 YOFF 0 WIDTH 1 HEIGHT 1 XPIC 0 YPIC 0
- Play
- MPEG=2
- end
- else do
- open Titel
- Play async
- Play wait
- end
- end
- else address command PlayMPEG" "MPEGA_OPTIONS" " '"'Titel'"'
- end
- when DT="CDR" then address command Play16 '"'Titel'"' " RAW FREQ=44100 TRACKS=2 BITS=16 INTEL "PL16_OPTIONS
- when DT="WAVE" then address command Play16 '"'Titel'"' " "PL16_OPTIONS
- when DT="AIFF" then address command Play16 '"'Titel'"' " "PL16_OPTIONS
- when DT="ADPCM3" then address command PlayADPCM '"'Titel'"' " NOFILTER"
- otherwise address command Play16 '"'Titel'"' " "PL16_OPTIONS
- end
- address value portname
- lister select handle '"'files.i'"' off
- lister refresh handle
- end
- call close ('input2')
- lister clear handle
- lister clear handle progress
- lister refresh handle
- if exists(Index||'1') then do
- address command 'Delete >NIL: '||Index
- address command 'rename from 'Index||"1"' to 'Index
- iterate
- end
- else leave
- end
-
- Ende:
- address value portname
- lister set handle title
- lister refresh handle full
- lister set handle busy off
- lister close handle
-
- if show('P','Peggy') & test=2 then do
- address 'Peggy'
- QUIT
- end
- address command 'Delete >NIL: '||Index
- exit
- /*--------------------------------------------------------------------------------*/
-
- DTTEST: /*Auf zulässige Sounddatei testen*/
- dopus getfiletype '"'Titel'"' id
- DT=result
- select
- when DT="MP2" then return
- when DT="ADPCM3" then return
- when DT="CDR" then return
- when DT="WAVE" then return
- when DT="VOC" then return
- when DT="AU" then return
- when DT="MAUD" then return
- when DT="AIFF" then return
- when DT="8SVX" then return
- otherwise do
- if DT='RESULT' then DT=getcatstr(13,'not identificed')
- dopus front
- dopus request '"'getcatstr(6,'Error:'lf'The file '"'%s'"' is filetype '"'%s'"lf'Format not supported !',files.i,DT)'"' getcatstr(7,'Next')
- DT=0
- end
- end
- return DT
-
- /*--------------------------------------------------------------------------------*/
- getcatstr:
- parse arg msgno,msgstring,insert.1,insert.2
- if catalog~=0 then msgstring=getcatalogstr(catalog,msgno,msgstring)
- j=0
- do while pos('%s',msgstring)>0
- parse var msgstring fore '%s' aft
- j=j+1
- msgstring=fore||insert.j||aft
- end
- return msgstring
-